package com.quanyan.club.mapper;

import com.quanyan.club.entity.db.TbChannelStream;
import com.quanyan.club.pullclub.entity.BatchSellRate;
import com.quanyan.club.pullclub.entity.resp.RespChannelIncomes;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


/**
 * Created by yue.yuan on 2016/12/2.
 */
public interface PullClubMapper {

    /**
     * 更新拉新用户id
     * @param paramMap
     * @return
     */
    int updateChannelUser(Map<String,Object> paramMap);

    /**
     * 扣减拉新的俱乐部抽奖次数
     * @param oldUid        老俱乐部主席uid
     * @param newClubId     新俱乐部id
     * @return
     */
    int updateDrawCountOfPullClub(@Param("oldUid") int oldUid, @Param("newClubId") int newClubId);

    /**
     * 扣减垃新抽奖奖品库存
     * @param hitPrizeId    中奖奖品id
     * @return
     */
    int updateLotteryStore(@Param("hitPrizeId") int hitPrizeId);

    List<RespChannelIncomes> selectSellByIncome(@Param("list") List<Integer> roleIds,
                                                @Param("roleType") int roleType);

    List<Integer> selectPullUid(@Param("pageStart") int pageStart, @Param("pageSize") int pageSize);

    List<Integer> selectPullClubsByUid(@Param("uid") int uid);

    int selectPullActivitiesByUid(@Param("uid") int uid);

    List<TbChannelStream> selectWithdrawDetails(@Param("roleId") int roleId,
                                                @Param("roleType") int roleType,
                                                @Param("limitStart") int pageStart,
                                                @Param("limitSize") int pageSize);

    int countWithdrawDetails(@Param("roleId") int roleId, @Param("roleType") int roleType);

    BigDecimal selectPullAmountByClubs(@Param("list") List<Integer> clubIds);
    /**
     * 获取拉新人数数量
     * @param codeList
     * @return
     */
    List<RespChannelIncomes> getNewUserNum(List<String> codeList);

    /**
     * 更新渠道商默认比例
     * @param paramMap
     * @return
     */
    int updateSellChannelRate(Map<String,Object> paramMap);

    /**
     * 批量更新比例
     * @param batchSellRateList
     * @return
     */
    int batchUpdateSellChannelRate(List<BatchSellRate> batchSellRateList);

    /**
     * 更新微信unionid
     * @param paramMap
     * @return
     */
    int updateChannelWeixin(Map<String,Object> paramMap);
}
